'\" t
.\"     Title: ndb_restore
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 09/19/2025
.\"    Manual: MySQL Database System
.\"    Source: MySQL 9.5
.\"  Language: English
.\"
.TH "NDB_RESTORE" "1" "09/19/2025" "MySQL 9\&.5" "MySQL Database System"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ndb_restore \- restore an NDB Cluster backup
.SH "SYNOPSIS"
.HP \w'\fBndb_restore\ \fR\fB\fIoptions\fR\fR\ 'u
\fBndb_restore \fR\fB\fIoptions\fR\fR
.SH "DESCRIPTION"
.PP
The NDB Cluster restoration program is implemented as a separate command\-line utility
\fBndb_restore\fR, which can normally be found in the MySQL
bin
directory\&. This program reads the files created as a result of the backup and inserts the stored information into the database\&.
.PP
\fBndb_restore\fR
must be executed once for each of the backup files that were created by the
START BACKUP
command used to create the backup (see
Section\ \&25.6.8.2, \(lqUsing The NDB Cluster Management Client to Create a Backup\(rq)\&. This is equal to the number of data nodes in the cluster at the time that the backup was created\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.PP
Before using
\fBndb_restore\fR, it is recommended that the cluster be running in single user mode, unless you are restoring multiple data nodes in parallel\&. See
Section\ \&25.6.6, \(lqNDB Cluster Single User Mode\(rq, for more information\&.
.sp .5v
.RE
.PP
Options that can be used with
\fBndb_restore\fR
are shown in the following table\&. Additional descriptions follow the table\&.
.PP
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-allow\-pk\-changes\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--allow-pk-changes[=0|1]
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
0
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
1
T}
.TE
.sp 1
When this option is set to
1,
\fBndb_restore\fR
allows the primary keys in a table definition to differ from that of the same table in the backup\&. This may be desirable when backing up and restoring between different schema versions with primary key changes on one or more tables, and it appears that performing the restore operation using ndb_restore is simpler or more efficient than issuing many
ALTER TABLE
statements after restoring table schemas and data\&.
.sp
The following changes in primary key definitions are supported by
\fB\-\-allow\-pk\-changes\fR:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBExtending the primary key\fR: A non\-nullable column that exists in the table schema in the backup becomes part of the table\*(Aqs primary key in the database\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
When extending a table\*(Aqs primary key, any columns which become part of primary key must not be updated while the backup is being taken; any such updates discovered by
\fBndb_restore\fR
cause the restore operation to fail, even when no change in value takes place\&. In some cases, it may be possible to override this behavior using the
\fB\-\-ignore\-extended\-pk\-updates\fR
option; see the description of this option for more information\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBContracting the primary key (1)\fR: A column that is already part of the table\*(Aqs primary key in the backup schema is no longer part of the primary key, but remains in the table\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBContracting the primary key (2)\fR: A column that is already part of the table\*(Aqs primary key in the backup schema is removed from the table entirely\&.
.RE
.sp
These differences can be combined with other schema differences supported by
\fBndb_restore\fR, including changes to blob and text columns requiring the use of staging tables\&.
.sp
Basic steps in a typical scenario using primary key schema changes are listed here:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
Restore table schemas using
\fBndb_restore\fR
\fB\-\-restore\-meta\fR
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
Alter schema to that desired, or create it
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
Back up the desired schema
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  4." 4.2
.\}
Run
\fBndb_restore\fR
\fB\-\-disable\-indexes\fR
using the backup from the previous step, to drop indexes and constraints
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 5.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  5." 4.2
.\}
Run
\fBndb_restore\fR
\fB\-\-allow\-pk\-changes\fR
(possibly along with
\fB\-\-ignore\-extended\-pk\-updates\fR,
\fB\-\-disable\-indexes\fR, and possibly other options as needed) to restore all data
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 6.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  6." 4.2
.\}
Run
\fBndb_restore\fR
\fB\-\-rebuild\-indexes\fR
using the backup made with the desired schema, to rebuild indexes and constraints
.RE
.sp
When extending the primary key, it may be necessary for
\fBndb_restore\fR
to use a temporary secondary unique index during the restore operation to map from the old primary key to the new one\&. Such an index is created only when necessary to apply events from the backup log to a table which has an extended primary key\&. This index is named
NDB$RESTORE_PK_MAPPING, and is created on each table requiring it; it can be shared, if necessary, by multiple instances of
\fBndb_restore\fR
instances running in parallel\&. (Running
\fBndb_restore\fR
\fB\-\-rebuild\-indexes\fR
at the end of the restore process causes this index to be dropped\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-append\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--append
T}
.TE
.sp 1
When used with the
\fB\-\-tab\fR
and
\fB\-\-print\-data\fR
options, this causes the data to be appended to any existing files having the same names\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-backup\-path\fR=\fIdir_name\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--backup-path=path
T}
T{
Type
T}:T{
Directory name
T}
T{
Default Value
T}:T{
./
T}
.TE
.sp 1
The path to the backup directory is required; this is supplied to
\fBndb_restore\fR
using the
\fB\-\-backup\-path\fR
option, and must include the subdirectory corresponding to the ID backup of the backup to be restored\&. For example, if the data node\*(Aqs
DataDir
is
/var/lib/mysql\-cluster, then the backup directory is
/var/lib/mysql\-cluster/BACKUP, and the backup files for the backup with the ID 3 can be found in
/var/lib/mysql\-cluster/BACKUP/BACKUP\-3\&. The path may be absolute or relative to the directory in which the
\fBndb_restore\fR
executable is located, and may be optionally prefixed with
\fBbackup\-path=\fR\&.
.sp
It is possible to restore a backup to a database with a different configuration than it was created from\&. For example, suppose that a backup with backup ID
12, created in a cluster with two storage nodes having the node IDs
2
and
3, is to be restored to a cluster with four nodes\&. Then
\fBndb_restore\fR
must be run twice\(emonce for each storage node in the cluster where the backup was taken\&. However,
\fBndb_restore\fR
cannot always restore backups made from a cluster running one version of MySQL to a cluster running a different MySQL version\&. See
Section\ \&25.3.7, \(lqUpgrading and Downgrading NDB Cluster\(rq, for more information\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
It is not possible to restore a backup made from a newer version of NDB Cluster using an older version of
\fBndb_restore\fR\&. You can restore a backup made from a newer version of MySQL to an older cluster, but you must use a copy of
\fBndb_restore\fR
from the newer NDB Cluster version to do so\&.
.sp
For example, to restore a cluster backup taken from a cluster running NDB Cluster 8\&.4\&.7 to a cluster running NDB Cluster 8\&.0\&.44, you must use the
\fBndb_restore\fR
that comes with the NDB Cluster 8\&.0\&.44 distribution\&.
.sp .5v
.RE
For more rapid restoration, the data may be restored in parallel, provided that there is a sufficient number of cluster connections available\&. That is, when restoring to multiple nodes in parallel, you must have an
[api]
or
[mysqld]
section in the cluster
config\&.ini
file available for each concurrent
\fBndb_restore\fR
process\&. However, the data files must always be applied before the logs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-backup\-password=\fR\fB\fIpassword\fR\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--backup-password=password
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
This option specifies a password to be used when decrypting an encrypted backup with the
\fB\-\-decrypt\fR
option\&. This must be the same password that was used to encrypt the backup\&.
.sp
The password must be 1 to 256 characters in length, and must be enclosed by single or double quotation marks\&. It can contain any of the ASCII characters having character codes 32, 35, 38, 40\-91, 93, 95, and 97\-126; in other words, it can use any printable ASCII characters except for
!,
\*(Aq,
",
$,
%,
\e, and
^\&.
.sp
It is possible to omit the password, in which case
\fBndb_restore\fR
waits for it to be supplied from
stdin, as when using
\fB\-\-backup\-password\-from\-stdin\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-backup\-password\-from\-stdin[=TRUE|FALSE]\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--backup-password-from-stdin
T}
.TE
.sp 1
When used in place of
\fB\-\-backup\-password\fR, this option enables input of the backup password from the system shell (stdin), similar to how this is done when supplying the password interactively to
\fBmysql\fR
when using the
\fB\-\-password\fR
without supplying the password on the command line\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-backupid\fR=\fI#\fR,
\fB\-b\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--backupid=#
T}
T{
Type
T}:T{
Numeric
T}
T{
Default Value
T}:T{
none
T}
.TE
.sp 1
This option is required; it is used to specify the ID or sequence number of the backup, and is the same number shown by the management client in the
Backup \fIbackup_id\fR completed
message displayed upon completion of a backup\&. (See
Section\ \&25.6.8.2, \(lqUsing The NDB Cluster Management Client to Create a Backup\(rq\&.)
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
When restoring cluster backups, you must be sure to restore all data nodes from backups having the same backup ID\&. Using files from different backups results at best in restoring the cluster to an inconsistent state, and is likely to fail altogether\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-character\-sets\-dir\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--character-sets-dir=path
T}
.TE
.sp 1
Directory containing character sets\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-connect\fR,
\fB\-c\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--connect=connection_string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
localhost:1186
T}
.TE
.sp 1
Alias for
\fB\-\-ndb\-connectstring\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-connect\-retries\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--connect-retries=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
12
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
12
T}
.TE
.sp 1
Number of times to retry connection before giving up\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-connect\-retry\-delay\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--connect-retry-delay=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
5
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
5
T}
.TE
.sp 1
Number of seconds to wait between attempts to contact management server\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-connect\-string\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--connect-string=connection_string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Same as
\fB\-\-ndb\-connectstring\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-core\-file\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--core-file
T}
.TE
.sp 1
Write core file on error; used in debugging\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-decrypt\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--decrypt
T}
.TE
.sp 1
Decrypt an encrypted backup using the password supplied by the
\fB\-\-backup\-password\fR
option\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\-extra\-file\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--defaults-extra-file=path
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Read given file after global files are read\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\-file\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--defaults-file=path
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Read default options from given file only\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-defaults\-group\-suffix\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--defaults-group-suffix=string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Also read groups with concat(group, suffix)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-disable\-indexes\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--disable-indexes
T}
.TE
.sp 1
Disable restoration of indexes during restoration of the data from a native
NDB
backup\&. Afterwards, you can restore indexes for all tables at once with multithreaded building of indexes using
\fB\-\-rebuild\-indexes\fR, which should be faster than rebuilding indexes concurrently for very large tables\&.
.sp
This option also drops any foreign keys specified in the backup\&.
.sp
MySQL can open an
NDB
table for which one or more indexes cannot be found, provided the query does not use any of the affected indexes; otherwise the query is rejected with
ER_NOT_KEYFILE\&. In the latter case, you can temporarily work around the problem by executing an
ALTER TABLE
statement such as this one:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER TABLE tbl ALTER INDEX idx INVISIBLE;
.fi
.if n \{\
.RE
.\}
.sp
This causes MySQL to ignore the index
idx
on table
tbl\&. See
Primary Keys and Indexes, for more information, as well as
Section\ \&10.3.12, \(lqInvisible Indexes\(rq\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-dont\-ignore\-systab\-0\fR,
\fB\-f\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--dont-ignore-systab-0
T}
.TE
.sp 1
Normally, when restoring table data and metadata,
\fBndb_restore\fR
ignores the copy of the
NDB
system table that is present in the backup\&.
\fB\-\-dont\-ignore\-systab\-0\fR
causes the system table to be restored\&.
\fIThis option is intended for experimental and development use only, and is not recommended in a production environment\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-exclude\-databases\fR=\fIdb\-list\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--exclude-databases=list
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
Comma\-delimited list of one or more databases which should not be restored\&.
.sp
This option is often used in combination with
\fB\-\-exclude\-tables\fR; see that option\*(Aqs description for further information and examples\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-exclude\-intermediate\-sql\-tables[\fR=\fITRUE|FALSE]\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--exclude-intermediate-sql-tables[=TRUE|FALSE]
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
TRUE
T}
.TE
.sp 1
When performing copying
ALTER TABLE
operations,
\fBmysqld\fR
creates intermediate tables (whose names are prefixed with
#sql\-)\&. When
TRUE, the
\fB\-\-exclude\-intermediate\-sql\-tables\fR
option keeps
\fBndb_restore\fR
from restoring such tables that may have been left over from these operations\&. This option is
TRUE
by default\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-exclude\-missing\-columns\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--exclude-missing-columns
T}
.TE
.sp 1
It is possible to restore only selected table columns using this option, which causes
\fBndb_restore\fR
to ignore any columns missing from tables being restored as compared to the versions of those tables found in the backup\&. This option applies to all tables being restored\&. If you wish to apply this option only to selected tables or databases, you can use it in combination with one or more of the
\fB\-\-include\-*\fR
or
\fB\-\-exclude\-*\fR
options described elsewhere in this section to do so, then restore data to the remaining tables using a complementary set of these options\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-exclude\-missing\-tables\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--exclude-missing-tables
T}
.TE
.sp 1
It is possible to restore only selected tables using this option, which causes
\fBndb_restore\fR
to ignore any tables from the backup that are not found in the target database\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-exclude\-tables\fR=\fItable\-list\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--exclude-tables=list
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
List of one or more tables to exclude; each table reference must include the database name\&. Often used together with
\fB\-\-exclude\-databases\fR\&.
.sp
When
\fB\-\-exclude\-databases\fR
or
\fB\-\-exclude\-tables\fR
is used, only those databases or tables named by the option are excluded; all other databases and tables are restored by
\fBndb_restore\fR\&.
.sp
This table shows several invocations of
\fBndb_restore\fR
using
\fB\-\-exclude\-*\fR
options (other options possibly required have been omitted for clarity), and the effects these options have on restoring from an NDB Cluster backup:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&25.23.\ \&Several invocations of ndb_restore using \-\-exclude\-* options, and the effects these options have on restoring from an NDB Cluster backup\&.
.TS
allbox tab(:);
lB lB.
T{
Option
T}:T{
Result
T}
.T&
l l
l l
l l
l l.
T{
\fB--exclude-databases=db1\fR
T}:T{
All tables in all databases except db1 are restored;
                  no tables in db1 are restored
T}
T{
\fB--exclude-databases=db1,db2\fR (or
                  \fB--exclude-databases=db1\fR
                  \fB--exclude-databases=db2\fR)
T}:T{
All tables in all databases except db1 and
                  db2 are restored; no tables in
                  db1 or db2 are
                  restored
T}
T{
\fB--exclude-tables=db1.t1\fR
T}:T{
All tables except t1 in database
                  db1 are restored; all other tables
                  in db1 are restored; all tables in
                  all other databases are restored
T}
T{
\fB--exclude-tables=db1.t2,db2.t1\fR (or
                  \fB--exclude-tables=db1.t2\fR
                  \fB--exclude-tables=db2.t1)\fR
T}:T{
All tables in database db1 except for
                  t2 and all tables in database
                  db2 except for table
                  t1 are restored; no other tables in
                  db1 or db2 are
                  restored; all tables in all other databases are
                  restored
T}
.TE
.sp 1
You can use these two options together\&. For example, the following causes all tables in all databases
\fIexcept for\fR
databases
db1
and
db2, and tables
t1
and
t2
in database
db3, to be restored:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore [\&.\&.\&.] \-\-exclude\-databases=db1,db2 \-\-exclude\-tables=db3\&.t1,db3\&.t2\fR
.fi
.if n \{\
.RE
.\}
.sp
(Again, we have omitted other possibly necessary options in the interest of clarity and brevity from the example just shown\&.)
.sp
You can use
\fB\-\-include\-*\fR
and
\fB\-\-exclude\-*\fR
options together, subject to the following rules:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
The actions of all
\fB\-\-include\-*\fR
and
\fB\-\-exclude\-*\fR
options are cumulative\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
All
\fB\-\-include\-*\fR
and
\fB\-\-exclude\-*\fR
options are evaluated in the order passed to ndb_restore, from right to left\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
In the event of conflicting options, the first (rightmost) option takes precedence\&. In other words, the first option (going from right to left) that matches against a given database or table
\(lqwins\(rq\&.
.RE
.sp
For example, the following set of options causes
\fBndb_restore\fR
to restore all tables from database
db1
except
db1\&.t1, while restoring no other tables from any other databases:
.sp
.if n \{\
.RS 4
.\}
.nf
\-\-include\-databases=db1 \-\-exclude\-tables=db1\&.t1
.fi
.if n \{\
.RE
.\}
.sp
However, reversing the order of the options just given simply causes all tables from database
db1
to be restored (including
db1\&.t1, but no tables from any other database), because the
\fB\-\-include\-databases\fR
option, being farthest to the right, is the first match against database
db1
and thus takes precedence over any other option that matches
db1
or any tables in
db1:
.sp
.if n \{\
.RS 4
.\}
.nf
\-\-exclude\-tables=db1\&.t1 \-\-include\-databases=db1
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-fields\-enclosed\-by\fR=\fIchar\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--fields-enclosed-by=char
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
Each column value is enclosed by the string passed to this option (regardless of data type; see the description of
\fB\-\-fields\-optionally\-enclosed\-by\fR)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-fields\-optionally\-enclosed\-by\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--fields-optionally-enclosed-by
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
The string passed to this option is used to enclose column values containing character data (such as
CHAR,
VARCHAR,
BINARY,
TEXT, or
ENUM)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-fields\-terminated\-by\fR=\fIchar\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--fields-terminated-by=char
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
\t (tab)
T}
.TE
.sp 1
The string passed to this option is used to separate column values\&. The default value is a tab character (\et)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-help\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--help
T}
.TE
.sp 1
Display help text and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-hex\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--hex
T}
.TE
.sp 1
If this option is used, all binary values are output in hexadecimal format\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ignore\-extended\-pk\-updates\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ignore-extended-pk-updates[=0|1]
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
0
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
1
T}
.TE
.sp 1
When using
\fB\-\-allow\-pk\-changes\fR, columns which become part of a table\*(Aqs primary key must not be updated while the backup is being taken; such columns should keep the same values from the time values are inserted into them until the rows containing the values are deleted\&. If
\fBndb_restore\fR
encounters updates to these columns when restoring a backup, the restore fails\&. Because some applications may set values for all columns when updating a row, even when some column values are not changed, the backup may include log events appearing to update columns which are not in fact modified\&. In such cases you can set
\fB\-\-ignore\-extended\-pk\-updates\fR
to
1, forcing
\fBndb_restore\fR
to ignore such updates\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
When causing these updates to be ignored, the user is responsible for ensuring that there are no updates to the values of any columns that become part of the primary key\&.
.sp .5v
.RE
For more information, see the description of
\fB\-\-allow\-pk\-changes\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-include\-databases\fR=\fIdb\-list\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--include-databases=list
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
Comma\-delimited list of one or more databases to restore\&. Often used together with
\fB\-\-include\-tables\fR; see the description of that option for further information and examples\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-include\-stored\-grants\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--include-stored-grants
T}
.TE
.sp 1
\fBndb_restore\fR
does not by default restore shared users and grants (see
Section\ \&25.6.13, \(lqPrivilege Synchronization and NDB_STORED_USER\(rq) to the
ndb_sql_metadata
table\&. Specifying this option causes it to do so\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-include\-tables\fR=\fItable\-list\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--include-tables=list
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
T}
.TE
.sp 1
Comma\-delimited list of tables to restore; each table reference must include the database name\&.
.sp
When
\fB\-\-include\-databases\fR
or
\fB\-\-include\-tables\fR
is used, only those databases or tables named by the option are restored; all other databases and tables are excluded by
\fBndb_restore\fR, and are not restored\&.
.sp
The following table shows several invocations of
\fBndb_restore\fR
using
\fB\-\-include\-*\fR
options (other options possibly required have been omitted for clarity), and the effects these have on restoring from an NDB Cluster backup:
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&25.24.\ \&Several invocations of ndb_restore using \-\-include\-* options, and their effects on restoring from an NDB Cluster backup\&.
.TS
allbox tab(:);
lB lB.
T{
Option
T}:T{
Result
T}
.T&
l l
l l
l l
l l.
T{
\fB--include-databases=db1\fR
T}:T{
Only tables in database db1 are restored; all tables
                  in all other databases are ignored
T}
T{
\fB--include-databases=db1,db2\fR (or
                  \fB--include-databases=db1\fR
                  \fB--include-databases=db2\fR)
T}:T{
Only tables in databases db1 and
                  db2 are restored; all tables in all
                  other databases are ignored
T}
T{
\fB--include-tables=db1.t1\fR
T}:T{
Only table t1 in database db1 is
                  restored; no other tables in db1 or
                  in any other database are restored
T}
T{
\fB--include-tables=db1.t2,db2.t1\fR (or
                  \fB--include-tables=db1.t2\fR
                  \fB--include-tables=db2.t1\fR)
T}:T{
Only the table t2 in database db1
                  and the table t1 in database
                  db2 are restored; no other tables
                  in db1, db2, or
                  any other database are restored
T}
.TE
.sp 1
You can also use these two options together\&. For example, the following causes all tables in databases
db1
and
db2, together with the tables
t1
and
t2
in database
db3, to be restored (and no other databases or tables):
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore [\&.\&.\&.] \-\-include\-databases=db1,db2 \-\-include\-tables=db3\&.t1,db3\&.t2\fR
.fi
.if n \{\
.RE
.\}
.sp
(Again we have omitted other, possibly required, options in the example just shown\&.)
.sp
It also possible to restore only selected databases, or selected tables from a single database, without any
\fB\-\-include\-*\fR
(or
\fB\-\-exclude\-*\fR) options, using the syntax shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
ndb_restore \fIother_options\fR \fIdb_name\fR,[\fIdb_name\fR[,\&.\&.\&.] | \fItbl_name\fR[,\fItbl_name\fR][,\&.\&.\&.]]
.fi
.if n \{\
.RE
.\}
.sp
In other words, you can specify either of the following to be restored:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
All tables from one or more databases
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
One or more tables from a single database
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-lines\-terminated\-by\fR=\fIchar\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--lines-terminated-by=char
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
\n (linebreak)
T}
.TE
.sp 1
Specifies the string used to end each line of output\&. The default is a linefeed character (\en)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-login\-path\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--login-path=path
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Read given path from login file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-login\-paths\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--no-login-paths
T}
.TE
.sp 1
Skips reading options from the login path file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-lossy\-conversions\fR,
\fB\-L\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--lossy-conversions
T}
.TE
.sp 1
This option is intended to complement the
\fB\-\-promote\-attributes\fR
option\&. Using
\fB\-\-lossy\-conversions\fR
allows lossy conversions of column values (type demotions or changes in sign) when restoring data from backup\&. With some exceptions, the rules governing demotion are the same as for MySQL replication; see
Section\ \&19.5.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for information about specific type conversions currently supported by attribute demotion\&.
.sp
This option also makes it possible to restore a
NULL
column as
NOT NULL\&. The column must not contain any
NULL
entries; otherwise
\fBndb_restore\fR
stops with an error\&.
.sp
\fBndb_restore\fR
reports any truncation of data that it performs during lossy conversions once per attribute and column\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-binlog\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--no-binlog
T}
.TE
.sp 1
This option prevents any connected SQL nodes from writing data restored by
\fBndb_restore\fR
to their binary logs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-restore\-disk\-objects\fR,
\fB\-d\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--no-restore-disk-objects
T}
.TE
.sp 1
This option stops
\fBndb_restore\fR
from restoring any NDB Cluster Disk Data objects, such as tablespaces and log file groups; see
Section\ \&25.6.11, \(lqNDB Cluster Disk Data Tables\(rq, for more information about these\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-upgrade\fR,
\fB\-u\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--no-upgrade
T}
.TE
.sp 1
When using
\fBndb_restore\fR
to restore a backup,
VARCHAR
columns created using the old fixed format are resized and recreated using the variable\-width format now employed\&. This behavior can be overridden by specifying
\fB\-\-no\-upgrade\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-connectstring\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ndb-connectstring=connection_string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Set connection string for connecting to
\fBndb_mgmd\fR\&. Syntax:
[nodeid=\fIid\fR;][host=]\fIhostname\fR[:\fIport\fR]\&. Overrides entries in
NDB_CONNECTSTRING
and
my\&.cnf\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-mgm\-tls\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ndb-mgm-tls=level
T}
T{
Type
T}:T{
Enumeration
T}
T{
Default Value
T}:T{
relaxed
T}
T{
Valid Values
T}:T{
.PP
relaxed
.PP
strict
T}
.TE
.sp 1
Sets the level of TLS support required to connect to the management server; one of
relaxed
or
strict\&.
relaxed
(the default) means that a TLS connection is attempted, but success is not required;
strict
means that TLS is required to connect\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-mgmd\-host\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ndb-mgmd-host=connection_string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Same as
\fB\-\-ndb\-connectstring\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-nodegroup\-map\fR=\fImap\fR,
\fB\-z\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--ndb-nodegroup-map=map
T}
.TE
.sp 1
Any value set for this option is ignored, and the option itself does nothing\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-nodeid\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ndb-nodeid=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
Set node ID for this node, overriding any ID set by
\fB\-\-ndb\-connectstring\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-optimized\-node\-selection\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--ndb-optimized-node-selection
T}
.TE
.sp 1
Enable optimizations for selection of nodes for transactions\&. Enabled by default; use
\fB\-\-skip\-ndb\-optimized\-node\-selection\fR
to disable\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-ndb\-tls\-search\-path\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--ndb-tls-search-path=list
T}
T{
Type
T}:T{
Path name
T}
T{
Default Value (Unix)
T}:T{
$HOME/ndb-tls
T}
T{
Default Value (Windows)
T}:T{
$HOMEDIR/ndb-tls
T}
.TE
.sp 1
Specify a list of directories to search for a CA file\&. On Unix platforms, the directory names are separated by colons (:); on Windows systems, the semicolon character (;) is used as the separator\&. A directory reference may be relative or absolute; it may contain one or more environment variables, each denoted by a prefixed dollar sign ($), and expanded prior to use\&.
.sp
Searching begins with the leftmost named directory and proceeds from left to right until a file is found\&. An empty string denotes an empty search path, which causes all searches to fail\&. A string consisting of a single dot (\&.) indicates that the search path limited to the current working directory\&.
.sp
If no search path is supplied, the compiled\-in default value is used\&. This value depends on the platform used: On Windows, this is
\endb\-tls; on other platforms (including Linux), it is
$HOME/ndb\-tls\&. This can be overridden by compiling NDB Cluster using
\fB\-DWITH_NDB_TLS_SEARCH_PATH\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-no\-defaults\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--no-defaults
T}
.TE
.sp 1
Do not read default options from any option file other than login file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-nodeid\fR=\fI#\fR,
\fB\-n\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--nodeid=#
T}
T{
Type
T}:T{
Numeric
T}
T{
Default Value
T}:T{
none
T}
.TE
.sp 1
Specify the node ID of the data node on which the backup was taken; required\&.
.sp
When restoring to a cluster with different number of data nodes from that where the backup was taken, this information helps identify the correct set or sets of files to be restored to a given node\&. (In such cases, multiple files usually need to be restored to a single data node\&.) See
\m[blue]\fBRestoring to a different number of data nodes\fR\m[]\&\s-2\u[1]\d\s+2, for additional information and examples\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-num\-slices\fR=\fI#\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--num-slices=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
1
T}
T{
Minimum Value
T}:T{
1
T}
T{
Maximum Value
T}:T{
1024
T}
.TE
.sp 1
When restoring a backup by slices, this option sets the number of slices into which to divide the backup\&. This allows multiple instances of
\fBndb_restore\fR
to restore disjoint subsets in parallel, potentially reducing the amount of time required to perform the restore operation\&.
.sp
A
\fIslice\fR
is a subset of the data in a given backup; that is, it is a set of fragments having the same slice ID, specified using the
\fB\-\-slice\-id\fR
option\&. The two options must always be used together, and the value set by
\fB\-\-slice\-id\fR
must always be less than the number of slices\&.
.sp
\fBndb_restore\fR
encounters fragments and assigns each one a fragment counter\&. When restoring by slices, a slice ID is assigned to each fragment; this slice ID is in the range 0 to 1 less than the number of slices\&. For a table that is not a
BLOB
table, the slice to which a given fragment belongs is determined using the formula shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
[\fIslice_ID\fR] = [\fIfragment_counter\fR] % [\fInumber_of_slices\fR]
.fi
.if n \{\
.RE
.\}
.sp
For a
BLOB
table, a fragment counter is not used; the fragment number is used instead, along with the ID of the main table for the
BLOB
table (recall that
NDB
stores
\fIBLOB\fR
values in a separate table internally)\&. In this case, the slice ID for a given fragment is calculated as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
[\fIslice_ID\fR] =
([\fImain_table_ID\fR] + [\fIfragment_ID\fR]) % [\fInumber_of_slices\fR]
.fi
.if n \{\
.RE
.\}
.sp
Thus, restoring by
\fIN\fR
slices means running
\fIN\fR
instances of
\fBndb_restore\fR, all with
\fB\-\-num\-slices=\fR\fB\fIN\fR\fR
(along with any other necessary options) and one each with
\fB\-\-slice\-id=1\fR,
\fB\-\-slice\-id=2\fR,
\fB\-\-slice\-id=3\fR, and so on through
\fBslice\-id=\fR\fB\fIN\fR\fR\fB\-1\fR\&.
.PP
\fBExample\fR. Assume that you want to restore a backup named
BACKUP\-1, found in the default directory
/var/lib/mysql\-cluster/BACKUP/BACKUP\-3
on the node file system on each data node, to a cluster with four data nodes having the node IDs 1, 2, 3, and 4\&. To perform this operation using five slices, execute the sets of commands shown in the following list:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
Restore the cluster metadata using
\fBndb_restore\fR
as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-b 1 \-n 1 \-m \-\-disable\-indexes \-\-backup\-path=/home/ndbuser/backups\fR
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
Restore the cluster data to the data nodes invoking
\fBndb_restore\fR
as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-b 1 \-n 1 \-r \-\-num\-slices=5 \-\-slice\-id=0 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 1 \-r \-\-num\-slices=5 \-\-slice\-id=1 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 1 \-r \-\-num\-slices=5 \-\-slice\-id=2 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 1 \-r \-\-num\-slices=5 \-\-slice\-id=3 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 1 \-r \-\-num\-slices=5 \-\-slice\-id=4 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 2 \-r \-\-num\-slices=5 \-\-slice\-id=0 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 2 \-r \-\-num\-slices=5 \-\-slice\-id=1 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 2 \-r \-\-num\-slices=5 \-\-slice\-id=2 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 2 \-r \-\-num\-slices=5 \-\-slice\-id=3 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 2 \-r \-\-num\-slices=5 \-\-slice\-id=4 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 3 \-r \-\-num\-slices=5 \-\-slice\-id=0 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 3 \-r \-\-num\-slices=5 \-\-slice\-id=1 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 3 \-r \-\-num\-slices=5 \-\-slice\-id=2 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 3 \-r \-\-num\-slices=5 \-\-slice\-id=3 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 3 \-r \-\-num\-slices=5 \-\-slice\-id=4 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 4 \-r \-\-num\-slices=5 \-\-slice\-id=0 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 4 \-r \-\-num\-slices=5 \-\-slice\-id=1 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 4 \-r \-\-num\-slices=5 \-\-slice\-id=2 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 4 \-r \-\-num\-slices=5 \-\-slice\-id=3 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
$> \fBndb_restore \-b 1 \-n 4 \-r \-\-num\-slices=5 \-\-slice\-id=4 \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
.fi
.if n \{\
.RE
.\}
.sp
All of the commands just shown in this step can be executed in parallel, provided there are enough slots for connections to the cluster (see the description for the
\fB\-\-backup\-path\fR
option)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
Restore indexes as usual, as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-b 1 \-n 1 \-\-rebuild\-indexes \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
.fi
.if n \{\
.RE
.\}
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  4." 4.2
.\}
Finally, restore the epoch, using the command shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-b 1 \-n 1 \-\-restore\-epoch \-\-backup\-path=/var/lib/mysql\-cluster/BACKUP/BACKUP\-1\fR
.fi
.if n \{\
.RE
.\}
.RE
.sp
You should use slicing to restore the cluster data only; it is not necessary to employ
\fB\-\-num\-slices\fR
or
\fB\-\-slice\-id\fR
when restoring the metadata, indexes, or epoch information\&. If either or both of these options are used with the
\fBndb_restore\fR
options controlling restoration of these, the program ignores them\&.
.sp
The effects of using the
\fB\-\-parallelism\fR
option on the speed of restoration are independent of those produced by slicing or parallel restoration using multiple instances of
\fBndb_restore\fR
(\fB\-\-parallelism\fR
specifies the number of parallel transactions executed by a
\fIsingle\fR
\fBndb_restore\fR
thread), but it can be used together with either or both of these\&. You should be aware that increasing
\fB\-\-parallelism\fR
causes
\fBndb_restore\fR
to impose a greater load on the cluster; if the system can handle this, restoration should complete even more quickly\&.
.sp
The value of
\fB\-\-num\-slices\fR
is not directly dependent on values relating to hardware such as number of CPUs or CPU cores, amount of RAM, and so forth, nor does it depend on the number of LDMs\&.
.sp
It is possible to employ different values for this option on different data nodes as part of the same restoration; doing so should not in and of itself produce any ill effects\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-parallelism\fR=\fI#\fR,
\fB\-p\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--parallelism=#
T}
T{
Type
T}:T{
Numeric
T}
T{
Default Value
T}:T{
128
T}
T{
Minimum Value
T}:T{
1
T}
T{
Maximum Value
T}:T{
1024
T}
.TE
.sp 1
\fBndb_restore\fR
uses single\-row transactions to apply many rows concurrently\&. This parameter determines the number of parallel transactions (concurrent rows) that an instance of
\fBndb_restore\fR
tries to use\&. By default, this is 128; the minimum is 1, and the maximum is 1024\&.
.sp
The work of performing the inserts is parallelized across the threads in the data nodes involved\&. This mechanism is employed for restoring bulk data from the
\&.Data
file\(emthat is, the fuzzy snapshot of the data; it is not used for building or rebuilding indexes\&. The change log is applied serially; index drops and builds are DDL operations and handled separately\&. There is no thread\-level parallelism on the client side of the restore\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-preserve\-trailing\-spaces\fR,
\fB\-P\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--preserve-trailing-spaces
T}
.TE
.sp 1
Cause trailing spaces to be preserved when promoting a fixed\-width character data type to its variable\-width equivalent\(emthat is, when promoting a
CHAR
column value to
VARCHAR, or a
BINARY
column value to
VARBINARY\&. Otherwise, any trailing spaces are dropped from such column values when they are inserted into the new columns\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
Although you can promote
CHAR
columns to
VARCHAR
and
BINARY
columns to
VARBINARY, you cannot promote
VARCHAR
columns to
CHAR
or
VARBINARY
columns to
BINARY\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-print\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print
T}
.TE
.sp 1
Causes
\fBndb_restore\fR
to print all data, metadata, and logs to
stdout\&. Equivalent to using the
\fB\-\-print\-data\fR,
\fB\-\-print\-meta\fR, and
\fB\-\-print\-log\fR
options together\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
Use of
\fB\-\-print\fR
or any of the
\fB\-\-print_*\fR
options is in effect performing a dry run\&. Including one or more of these options causes any output to be redirected to
stdout; in such cases,
\fBndb_restore\fR
makes no attempt to restore data or metadata to an NDB Cluster\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-print\-data\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print-data
T}
.TE
.sp 1
Cause
\fBndb_restore\fR
to direct its output to
stdout\&. Often used together with one or more of
\fB\-\-tab\fR,
\fB\-\-fields\-enclosed\-by\fR,
\fB\-\-fields\-optionally\-enclosed\-by\fR,
\fB\-\-fields\-terminated\-by\fR,
\fB\-\-hex\fR, and
\fB\-\-append\fR\&.
.sp
TEXT
and
BLOB
column values are always truncated\&. Such values are truncated to the first 256 bytes in the output\&. This cannot currently be overridden when using
\fB\-\-print\-data\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-print\-defaults\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print-defaults
T}
.TE
.sp 1
Print program argument list and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-print\-log\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print-log
T}
.TE
.sp 1
Cause
\fBndb_restore\fR
to output its log to
stdout\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-print\-meta\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print-meta
T}
.TE
.sp 1
Print all metadata to
stdout\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fBprint\-sql\-log\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--print-sql-log
T}
.TE
.sp 1
Log SQL statements to
stdout\&. Use the option to enable; normally this behavior is disabled\&. The option checks before attempting to log whether all the tables being restored have explicitly defined primary keys; queries on a table having only the hidden primary key implemented by
NDB
cannot be converted to valid SQL\&.
.sp
This option does not work with tables having
BLOB
columns\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-progress\-frequency\fR=\fIN\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--progress-frequency=#
T}
T{
Type
T}:T{
Numeric
T}
T{
Default Value
T}:T{
0
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
65535
T}
.TE
.sp 1
Print a status report each
\fIN\fR
seconds while the backup is in progress\&. 0 (the default) causes no status reports to be printed\&. The maximum is 65535\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-promote\-attributes\fR,
\fB\-A\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--promote-attributes
T}
.TE
.sp 1
\fBndb_restore\fR
supports limited
\fIattribute promotion\fR
in much the same way that it is supported by MySQL replication; that is, data backed up from a column of a given type can generally be restored to a column using a
\(lqlarger, similar\(rq
type\&. For example, data from a
CHAR(20)
column can be restored to a column declared as
VARCHAR(20),
VARCHAR(30), or
CHAR(30); data from a
MEDIUMINT
column can be restored to a column of type
INT
or
BIGINT\&. See
Section\ \&19.5.1.9.2, \(lqReplication of Columns Having Different Data Types\(rq, for a table of type conversions currently supported by attribute promotion\&.
.sp
This option also makes it possible to restore a
NOT NULL
column as
NULL\&.
.sp
Attribute promotion by
\fBndb_restore\fR
must be enabled explicitly, as follows:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
Prepare the table to which the backup is to be restored\&.
\fBndb_restore\fR
cannot be used to re\-create the table with a different definition from the original; this means that you must either create the table manually, or alter the columns which you wish to promote using
ALTER TABLE
after restoring the table metadata but before restoring the data\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
Invoke
\fBndb_restore\fR
with the
\fB\-\-promote\-attributes\fR
option (short form
\fB\-A\fR) when restoring the table data\&. Attribute promotion does not occur if this option is not used; instead, the restore operation fails with an error\&.
.RE
.sp
When converting between character data types and
TEXT
or
BLOB, only conversions between character types (CHAR
and
VARCHAR) and binary types (BINARY
and
VARBINARY) can be performed at the same time\&. For example, you cannot promote an
INT
column to
BIGINT
while promoting a
VARCHAR
column to
TEXT
in the same invocation of
\fBndb_restore\fR\&.
.sp
Converting between
TEXT
columns using different character sets is not supported, and is expressly disallowed\&.
.sp
When performing conversions of character or binary types to
TEXT
or
BLOB
with
\fBndb_restore\fR, you may notice that it creates and uses one or more staging tables named
\fItable_name\fR$ST\fInode_id\fR\&. These tables are not needed afterwards, and are normally deleted by
\fBndb_restore\fR
following a successful restoration\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-rebuild\-indexes\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--rebuild-indexes
T}
.TE
.sp 1
Enable multithreaded rebuilding of the ordered indexes while restoring a native
NDB
backup\&. The number of threads used for building ordered indexes by
\fBndb_restore\fR
with this option is controlled by the
BuildIndexThreads
data node configuration parameter and the number of LDMs\&.
It is necessary to use this option only for the first run of
\fBndb_restore\fR; this causes all ordered indexes to be rebuilt without using
\fB\-\-rebuild\-indexes\fR
again when restoring subsequent nodes\&. You should use this option prior to inserting new rows into the database; otherwise, it is possible for a row to be inserted that later causes a unique constraint violation when trying to rebuild the indexes\&.
.sp
Building of ordered indices is parallelized with the number of LDMs by default\&. Offline index builds performed during node and system restarts can be made faster using the
BuildIndexThreads
data node configuration parameter; this parameter has no effect on dropping and rebuilding of indexes by
\fBndb_restore\fR, which is performed online\&.
.sp
Rebuilding of unique indexes uses disk write bandwidth for redo logging and local checkpointing\&. An insufficient amount of this bandwidth can lead to redo buffer overload or log overload errors\&. In such cases you can run
\fBndb_restore\fR
\fB\-\-rebuild\-indexes\fR
again; the process resumes at the point where the error occurred\&. You can also do this when you have encountered temporary errors\&. You can repeat execution of
\fBndb_restore\fR
\fB\-\-rebuild\-indexes\fR
indefinitely; you may be able to stop such errors by reducing the value of
\fB\-\-parallelism\fR\&. If the problem is insufficient space, you can increase the size of the redo log (FragmentLogFileSize
node configuration parameter), or you can increase the speed at which LCPs are performed (MaxDiskWriteSpeed
and related parameters), in order to free space more quickly\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-remap\-column=\fR\fB\fIdb\fR\fR\fB\&.\fR\fB\fItbl\fR\fR\fB\&.\fR\fB\fIcol\fR\fR\fB:\fR\fB\fIfn\fR\fR\fB:\fR\fB\fIargs\fR\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--remap-column=string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
[none]
T}
.TE
.sp 1
When used together with
\fB\-\-restore\-data\fR, this option applies a function to the value of the indicated column\&. Values in the argument string are listed here:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIdb\fR: Database name, following any renames performed by
\fB\-\-rewrite\-database\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fItbl\fR: Table name\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIcol\fR: Name of the column to be updated\&. This column must be of type
INT
or
BIGINT\&. The column can also be but is not required to be
UNSIGNED\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIfn\fR: Function name; currently, the only supported name is
offset\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fIargs\fR: Arguments supplied to the function\&. Currently, only a single argument, the size of the offset to be added by the
offset
function, is supported\&. Negative values are supported\&. The size of the argument cannot exceed that of the signed variant of the column\*(Aqs type; for example, if
\fIcol\fR
is an
INT
column, then the allowed range of the argument passed to the
offset
function is
\-2147483648
to
2147483647
(see
Section\ \&13.1.2, \(lqInteger Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT\(rq)\&.
.sp
If applying the offset value to the column would cause an overflow or underflow, the restore operation fails\&. This could happen, for example, if the column is a
BIGINT, and the option attempts to apply an offset value of 8 on a row in which the column value is 4294967291, since
4294967291 + 8 = 4294967299 > 4294967295\&.
.RE
.sp
This option can be useful when you wish to merge data stored in multiple source instances of NDB Cluster (all using the same schema) into a single destination NDB Cluster, using NDB native backup (see
Section\ \&25.6.8.2, \(lqUsing The NDB Cluster Management Client to Create a Backup\(rq) and
\fBndb_restore\fR
to merge the data, where primary and unique key values are overlapping between source clusters, and it is necessary as part of the process to remap these values to ranges that do not overlap\&. It may also be necessary to preserve other relationships between tables\&. To fulfill such requirements, it is possible to use the option multiple times in the same invocation of
\fBndb_restore\fR
to remap columns of different tables, as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-\-restore\-data \-\-remap\-column=hr\&.employee\&.id:offset:1000 \e
    \-\-remap\-column=hr\&.manager\&.id:offset:1000 \-\-remap\-column=hr\&.firstaiders\&.id:offset:1000\fR
.fi
.if n \{\
.RE
.\}
.sp
(Other options not shown here may also be used\&.)
.sp
\fB\-\-remap\-column\fR
can also be used to update multiple columns of the same table\&. Combinations of multiple tables and columns are possible\&. Different offset values can also be used for different columns of the same table, like this:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_restore \-\-restore\-data \-\-remap\-column=hr\&.employee\&.salary:offset:10000 \e
    \-\-remap\-column=hr\&.employee\&.hours:offset:\-10\fR
.fi
.if n \{\
.RE
.\}
.sp
When source backups contain duplicate tables which should not be merged, you can handle this by using
\fB\-\-exclude\-tables\fR,
\fB\-\-exclude\-databases\fR, or by some other means in your application\&.
.sp
Information about the structure and other characteristics of tables to be merged can obtained using
SHOW CREATE TABLE; the
\fBndb_desc\fR
tool; and
MAX(),
MIN(),
LAST_INSERT_ID(), and other MySQL functions\&.
.sp
Replication of changes from merged to unmerged tables, or from unmerged to merged tables, in separate instances of NDB Cluster is not supported\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-restore\-data\fR,
\fB\-r\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--restore-data
T}
.TE
.sp 1
Output
NDB
table data and logs\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-restore\-epoch\fR,
\fB\-e\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--restore-epoch
T}
.TE
.sp 1
Add (or restore) epoch information to the cluster replication status table\&. This is useful for starting replication on an NDB Cluster replica\&. When this option is used, the row in the
mysql\&.ndb_apply_status
having
0
in the
id
column is updated if it already exists; such a row is inserted if it does not already exist\&. (See
Section\ \&25.7.9, \(lqNDB Cluster Backups With NDB Cluster Replication\(rq\&.)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-restore\-meta\fR,
\fB\-m\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--restore-meta
T}
.TE
.sp 1
This option causes
\fBndb_restore\fR
to print
NDB
table metadata\&.
.sp
The first time you run the
\fBndb_restore\fR
restoration program, you also need to restore the metadata\&. In other words, you must re\-create the database tables\(emthis can be done by running it with the
\fB\-\-restore\-meta\fR
(\fB\-m\fR) option\&. Restoring the metadata need be done only on a single data node; this is sufficient to restore it to the entire cluster\&.
.sp
\fBndb_restore\fR
uses the default number of partitions for the target cluster, unless the number of local data manager threads is also changed from what it was for data nodes in the original cluster\&.
.sp
When using this option, it is recommended that auto synchronization be disabled by setting
ndb_metadata_check=OFF
until
\fBndb_restore\fR
has completed restoring the metadata, after which it can it turned on again to synchronize objects newly created in the NDB dictionary\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
The cluster should have an empty database when starting to restore a backup\&. (In other words, you should start the data nodes with
\fB\-\-initial\fR
prior to performing the restore\&.)
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-rewrite\-database\fR=\fIolddb,newdb\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--rewrite-database=string
T}
T{
Type
T}:T{
String
T}
T{
Default Value
T}:T{
none
T}
.TE
.sp 1
This option makes it possible to restore to a database having a different name from that used in the backup\&. For example, if a backup is made of a database named
products, you can restore the data it contains to a database named
inventory, use this option as shown here (omitting any other options that might be required):
.sp
.if n \{\
.RS 4
.\}
.nf
$> ndb_restore \-\-rewrite\-database=product,inventory
.fi
.if n \{\
.RE
.\}
.sp
The option can be employed multiple times in a single invocation of
\fBndb_restore\fR\&. Thus it is possible to restore simultaneously from a database named
db1
to a database named
db2
and from a database named
db3
to one named
db4
using
\fB\-\-rewrite\-database=db1,db2 \-\-rewrite\-database=db3,db4\fR\&. Other
\fBndb_restore\fR
options may be used between multiple occurrences of
\fB\-\-rewrite\-database\fR\&.
.sp
In the event of conflicts between multiple
\fB\-\-rewrite\-database\fR
options, the last
\fB\-\-rewrite\-database\fR
option used, reading from left to right, is the one that takes effect\&. For example, if
\fB\-\-rewrite\-database=db1,db2 \-\-rewrite\-database=db1,db3\fR
is used, only
\fB\-\-rewrite\-database=db1,db3\fR
is honored, and
\fB\-\-rewrite\-database=db1,db2\fR
is ignored\&. It is also possible to restore from multiple databases to a single database, so that
\fB\-\-rewrite\-database=db1,db3 \-\-rewrite\-database=db2,db3\fR
restores all tables and data from databases
db1
and
db2
into database
db3\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
When restoring from multiple backup databases into a single target database using
\fB\-\-rewrite\-database\fR, no check is made for collisions between table or other object names, and the order in which rows are restored is not guaranteed\&. This means that it is possible in such cases for rows to be overwritten and updates to be lost\&.
.sp .5v
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-broken\-objects\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--skip-broken-objects
T}
.TE
.sp 1
This option causes
\fBndb_restore\fR
to ignore corrupt tables while reading a native
NDB
backup, and to continue restoring any remaining tables (that are not also corrupted)\&. Currently, the
\fB\-\-skip\-broken\-objects\fR
option works only in the case of missing blob parts tables\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-table\-check\fR,
\fB\-s\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--skip-table-check
T}
.TE
.sp 1
It is possible to restore data without restoring table metadata\&. By default when doing this,
\fBndb_restore\fR
fails with an error if a mismatch is found between the table data and the table schema; this option overrides that behavior\&.
.sp
Some of the restrictions on mismatches in column definitions when restoring data using
\fBndb_restore\fR
are relaxed; when one of these types of mismatches is encountered,
\fBndb_restore\fR
does not stop with an error as it did previously, but rather accepts the data and inserts it into the target table while issuing a warning to the user that this is being done\&. This behavior occurs whether or not either of the options
\fB\-\-skip\-table\-check\fR
or
\fB\-\-promote\-attributes\fR
is in use\&. These differences in column definitions are of the following types:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Different
COLUMN_FORMAT
settings (FIXED,
DYNAMIC,
DEFAULT)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Different
STORAGE
settings (MEMORY,
DISK)
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Different default values
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Different distribution key settings
.RE
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-skip\-unknown\-objects\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--skip-unknown-objects
T}
.TE
.sp 1
This option causes
\fBndb_restore\fR
to ignore any schema objects it does not recognize while reading a native
NDB
backup\&. This can be used for restoring a backup made from a cluster running (for example) NDB 7\&.6 to a cluster running NDB Cluster 7\&.5\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-slice\-id\fR=\fI#\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--slice-id=#
T}
T{
Type
T}:T{
Integer
T}
T{
Default Value
T}:T{
0
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
1023
T}
.TE
.sp 1
When restoring by slices, this is the ID of the slice to restore\&. This option is always used together with
\fB\-\-num\-slices\fR, and its value must be always less than that of
\fB\-\-num\-slices\fR\&.
.sp
For more information, see the description of the
\fB\-\-num\-slices\fR
elsewhere in this section\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-tab\fR=\fIdir_name\fR,
\fB\-T\fR
\fIdir_name\fR
.TS
allbox tab(:);
lB l
lB l.
T{
Command-Line Format
T}:T{
--tab=path
T}
T{
Type
T}:T{
Directory name
T}
.TE
.sp 1
Causes
\fB\-\-print\-data\fR
to create dump files, one per table, each named
\fItbl_name\fR\&.txt\&. It requires as its argument the path to the directory where the files should be saved; use
\&.
for the current directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-timestamp\-printouts\fR
.TS
allbox tab(:);
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--timestamp-printouts{=true|false}
T}
T{
Type
T}:T{
Boolean
T}
T{
Default Value
T}:T{
true
T}
.TE
.sp 1
Causes info, error, and debug log messages to be prefixed with timestamps\&.
.sp
This option is enabled by default\&. Disable it with
\fB\-\-timestamp\-printouts=false\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-usage\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--usage
T}
.TE
.sp 1
Display help text and exit; same as
\fB\-\-help\fR\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-verbose\fR=\fI#\fR
.TS
allbox tab(:);
lB l
lB l
lB l
lB l
lB l.
T{
Command-Line Format
T}:T{
--verbose=#
T}
T{
Type
T}:T{
Numeric
T}
T{
Default Value
T}:T{
1
T}
T{
Minimum Value
T}:T{
0
T}
T{
Maximum Value
T}:T{
255
T}
.TE
.sp 1
Sets the level for the verbosity of the output\&. The minimum is 0; the maximum is 255\&. The default value is 1\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-version\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--version
T}
.TE
.sp 1
Display version information and exit\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
\fB\-\-with\-apply\-status\fR
.TS
allbox tab(:);
lB l.
T{
Command-Line Format
T}:T{
--with-apply-status
T}
.TE
.sp 1
Restore all rows from the backup\*(Aqs
ndb_apply_status
table (except for the row having
server_id = 0, which is generated using
\fB\-\-restore\-epoch\fR)\&. This option requires that
\fB\-\-restore\-data\fR
also be used\&.
.sp
If the
ndb_apply_status
table from the backup already contains a row with
server_id = 0,
\fBndb_restore\fR
\fB\-\-with\-apply\-status\fR
deletes it\&. For this reason, we recommend that you use
\fBndb_restore\fR
\fB\-\-restore\-epoch\fR
after invoking
\fBndb_restore\fR
with the
\fB\-\-with\-apply\-status\fR
option\&. You can also use
\fB\-\-restore\-epoch\fR
concurrently with the last of any invocations of
\fBndb_restore\fR
\fB\-\-with\-apply\-status\fR
used to restore the cluster\&.
.sp
For more information, see
the section called \(lqndb_apply_status Table\(rq\&.
.RE
.PP
Typical options for this utility are shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
ndb_restore [\-c \fIconnection_string\fR] \-n \fInode_id\fR \-b \fIbackup_id\fR \e
      [\-m] \-r \-\-backup\-path=\fI/path/to/backup/files\fR
.fi
.if n \{\
.RE
.\}
.PP
Normally, when restoring from an NDB Cluster backup,
\fBndb_restore\fR
requires at a minimum the
\fB\-\-nodeid\fR
(short form:
\fB\-n\fR),
\fB\-\-backupid\fR
(short form:
\fB\-b\fR), and
\fB\-\-backup\-path\fR
options\&.
.PP
The
\fB\-c\fR
option is used to specify a connection string which tells
ndb_restore
where to locate the cluster management server (see
Section\ \&25.4.3.3, \(lqNDB Cluster Connection Strings\(rq)\&. If this option is not used, then
\fBndb_restore\fR
attempts to connect to a management server on
localhost:1186\&. This utility acts as a cluster API node, and so requires a free connection
\(lqslot\(rq
to connect to the cluster management server\&. This means that there must be at least one
[api]
or
[mysqld]
section that can be used by it in the cluster
config\&.ini
file\&. It is a good idea to keep at least one empty
[api]
or
[mysqld]
section in
config\&.ini
that is not being used for a MySQL server or other application for this reason (see
Section\ \&25.4.3.7, \(lqDefining SQL and Other API Nodes in an NDB Cluster\(rq)\&.
.PP
\fBndb_restore\fR
can decrypt an encrypted backup using
\fB\-\-decrypt\fR
and
\fB\-\-backup\-password\fR\&. Both options must be specified to perform decryption\&. See the documentation for the
START BACKUP
management client command for information on creating encrypted backups\&.
.PP
You can verify that
\fBndb_restore\fR
is connected to the cluster by using the
SHOW
command in the
\fBndb_mgm\fR
management client\&. You can also accomplish this from a system shell, as shown here:
.sp
.if n \{\
.RS 4
.\}
.nf
$> \fBndb_mgm \-e "SHOW"\fR
.fi
.if n \{\
.RE
.\}
.PP
\fBError reporting\fR. \fBndb_restore\fR
reports both temporary and permanent errors\&. In the case of temporary errors, it may able to recover from them, and reports
Restore successful, but encountered temporary error, please look at configuration
in such cases\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
.PP
After using
\fBndb_restore\fR
to initialize an NDB Cluster for use in circular replication, binary logs on the SQL node acting as the replica are not automatically created, and you must cause them to be created manually\&. To cause the binary logs to be created, issue a
SHOW TABLES
statement on that SQL node before running
START REPLICA\&. This is a known issue in NDB Cluster\&.
.sp .5v
.RE
.SH "COPYRIGHT"
.br
.PP
Copyright \(co 1997, 2025, Oracle and/or its affiliates.
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
.PP
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/.
.sp
.SH "NOTES"
.IP " 1." 4
Restoring to a different number of data nodes
.RS 4
\%https://dev.mysql.com/doc/refman/8.0/en/ndb-restore-different-number-nodes.html
.RE
.SH "SEE ALSO"
For more information, please refer to the MySQL Reference Manual,
which may already be installed locally and which is also available
online at http://dev.mysql.com/doc/.
.SH AUTHOR
Oracle Corporation (http://dev.mysql.com/).
